if ( !window.controller ) throw new Error( '"controller" not initialized' );

controller.require( 'controller.events' );

if ( !controller.events.dom ) {
	controller.events.dom = new ( function() {

		//--------------------------------------------------------------------------
		//
		//  Class variables
		//
		//--------------------------------------------------------------------------

		var	msie =	controller.browser.getMSIE();

		//--------------------------------------------------------------------------
		//
		//  Constructor
		//
		//--------------------------------------------------------------------------

		/**
		* @private
		* @constructor
		*/
		var Dom = new Function(),
		DomPrototype = Dom.prototype;

		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------

		/**
		* @method
		* @param	{HTMLElement}	target
		* @param	{String}		type
		* @param	{Function}		func
		*/
		DomPrototype.addEventListener = ( msie
		?	function(target, type, func) {
			target.attachEvent( 'on' + type, func );
		}
		:	function(target, type, func) {
			if ( type == 'mousewheel' ) type = 'DOMMouseScroll';
			target.addEventListener( type, func, false );
		}
		);

		/**
		* @method
		* @param	{HTMLElement}	target
		* @param	{String}		type
		* @param	{Function}		func
		*/
		DomPrototype.removeEventListener = ( msie
		?	function(target, type, func) {
			target.detachEvent( 'on' + type, func );
		}
		:	function(target, type, func) {
			if ( type == 'mousewheel' ) type = 'DOMMouseScroll';
			target.removeEventListener( type, func, false );
		}
		);

		/**
		* @method
		* @return	{String}
		*/
		DomPrototype.toString = function() {
			return '[Dom object]';
		};

		return Dom;

	}() );
}